<template>
  <div class="chart-box">
    <Pie class="chart" :loading="loadingRef" :chartData="chartData" title="本周期数据占比" />
  </div>
</template>
<script lang="ts" setup>
import {  ref } from 'vue';
import { getRatioData} from '@/api/dataReport/energyStatistics'
import Pie from '@/components/Charts/Pie/index.vue'

const chartData = ref([])

const loadingRef = ref(false)


const getData = (searchInfo) => {
  loadingRef.value = true;
  // 数据环比
  getRatioData(searchInfo).then(data => {
    chartData.value = data
  }).catch(e => {
    chartData.value = []
  }).finally(() => {
    loadingRef.value = false;
  })
}

defineExpose({
  getData
})
</script>
